documented
Derive and attribute macros for accessing your type's documentation at runtime
Quick start
use documented::{Documented, DocumentedFields, DocumentedVariants};
#[derive(Documented, DocumentedFields, DocumentedVariants)]
enum AlwaysPlay {
#[allow(dead_code)]
Kb1,
F6,
}
assert_eq!(AlwaysPlay::DOCS, "Trying is the first step to failure.");
assert_eq!(
AlwaysPlay::FIELD_DOCS,
["And Kb8.", "But only if you are white."]
);
assert_eq!(AlwaysPlay::get_field_docs("Kb1"), Ok("And Kb8."));
assert_eq!(
AlwaysPlay::F6.get_variant_docs(),
"But only if you are white."
);